<?php
/*
 * 1626cms 個人會員中心
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
 */
define('IN_QISHI', true);
require_once(dirname(__FILE__) . '/include/common.inc.php');
$smarty->caching = false;
$page_select="user";
require_once(QISHI_ROOT_PATH.'include/mysql.class.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);
unset($dbhost,$dbuser,$dbpass,$dbname);
if ($_SESSION['uid']=='' || $_SESSION['username']=='' || $_SESSION['utype']!='2') header("Location: user.php");
if ($_SESSION['utype']!='2') showmsg('請先登陸個人會員，再進行相關操作！',1);
require_once(QISHI_ROOT_PATH.'include/fun_category.php');
require_once(QISHI_ROOT_PATH.'include/fun_user_personal.php');
require_once(QISHI_ROOT_PATH.'include/fun_resume.php');
$act = !empty($_REQUEST['act']) ? trim($_REQUEST['act']) : 'resume_all';

$resume_basic=get_resume_basic($_SESSION['uid']);//簡歷基本資料
//$resume_intention=get_resume_intention($_SESSION['uid']);//求職意向
$resume_intention_foremail=get_resume_intention_foremail($_SESSION['uid']);//求職意向
$resume_specialty=get_resume_specialty($_SESSION['uid']);//技能特長
$resume_education=get_resume_education($_SESSION['uid']);//教育經歷
$resume_work=get_resume_work($_SESSION['uid']);//工作經歷
$resume_training=get_resume_training($_SESSION['uid']);//培訓經歷
$resume_photo=get_resume_photo($_SESSION['uid']);//形象照片
$photo_dir=substr($_CFG['resume_photo_dir'],mb_strlen($_CFG['site_dir']));  //照片存放目錄-絕對路徑轉化成相對路徑
$photo_thumb_dir=substr($_CFG['resume_photo_dir_thumb'],mb_strlen($_CFG['site_dir']));//照片縮略圖存放-絕對路徑轉化成相對路徑
$smarty->assign('resume_basic',$resume_basic);
//$smarty->assign('resume_intention',$resume_intention);
$smarty->assign('resume_intention_foremail',$resume_intention_foremail);
//print_r($resume_intention_foremail);
//exit;
$smarty->assign('resume_specialty',$resume_specialty);
$smarty->assign('resume_education',$resume_education);
$smarty->assign('resume_work',$resume_work);
$smarty->assign('resume_training',$resume_training);
$smarty->assign('resume_photo',$resume_photo);
//統計總數
$smarty->assign('count_invitation_interview',count_invitation_interview($_SESSION['uid']));
$smarty->assign('count_personal_jobs_apply',count_personal_jobs_apply($_SESSION['uid']));
$smarty->assign('count_jobs_library',count_jobs_library($_SESSION['uid']));
//****
//*************************************************服務中心首頁**********************
//服務中心首頁,强制填写资料
if (!$resume_basic && $act!='save_resume_all'  && $act!='resume_all')
{
	echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_all'</script>");
	exit();
}
//if (!$resume_basic && $act!='save_resume_basic'  && $act!='resume_basic')
//{
//	echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_basic'</script>");
//	exit();
//}
if ($act=='index')
{
	$smarty->assign('title','個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('username',$_SESSION['username']);
	$smarty->assign('resume_click',get_resume_click($_SESSION['uid']));
	$smarty->display('member_personal/personal_index.htm');
}
//*************************************************編輯簡歷**********************
//簡歷所有內容
if ($act=='resume')
{
	$smarty->assign('random',mt_rand());//隨機數
	$smarty->assign('intention_nature',get_resume_intention_nature($_SESSION['uid']));//意向職位性質
	$smarty->assign('intention_jobs',get_resume_intention_jobs($_SESSION['uid']));//意向職位
	$smarty->assign('intention_area',get_resume_intention_area($_SESSION['uid']));//期望地區
	$smarty->assign('intention_trade',get_resume_intention_trade($_SESSION['uid']));//期望行業
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume.htm');
}
//简历集成
if ($act=='resume_all')
{
	$resume_all=get_resume_all($_SESSION['uid']);//簡歷基本資料
	$smarty->assign('resume_all',$resume_all);
	require_once(QISHI_ROOT_PATH.'include/fun_user.php');
	$user_info=get_user_inid($_SESSION['uid']);
	$formlood=array('1','2','3','4');
	$smarty->assign('act',$act);
	$smarty->assign('formlood',$formlood);
	$smarty->assign('email',$user_info['email']);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('officename',$_CFG['site_name']);
	$smarty->assign('experience',get_jobs_experience());
	$smarty->assign('education',get_jobs_education());
	$smarty->assign('area',get_jobs_area());
	$smarty->assign('ways',get_wayofeducation());
	$smarty->display('member_personal/personal_resume_all.htm');
}
if ($act=='save_resume_all')
{
	$_POST=htmldecode($_POST);
	$setsqlarr['uid']=$_SESSION['uid'];
	foreach($_POST['b'] as $key=>$base)
	{
		$setsqlarr[$key]=trim($base);
	}
	//基礎信息保存
	$setsqlarr['refreshtime']=$timestamp;
	if ($_CFG['audit_resume']==1)//假如發布簡歷需要審核
	{
		$setsqlarr['audit']=2;
	}
	else
	{
		$setsqlarr['audit']=1;
	}
	if ($resume_basic)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable(table('resume'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	}
	else
	{
		$setsqlarr['addtime']=$timestamp;
		$setsqlarr['deadline']=strtotime("+".intval($_POST['deadline'])." day");
		!inserttable(table('resume'),$setsqlarr)?showmsg("保存失敗！",0):'';
		$resume_click['uid']=$_SESSION['uid'];//
		$resume_click['click']=1;//
		!inserttable(table('resume_click'),$resume_click)?showmsg("保存失敗！",0):'';//插入簡歷點擊次數
	}
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態

	//更新特長技能，其他
	$setsqlarr['uid']=$_SESSION['uid'];
	foreach($_POST['s'] as $key=>$base)
	{
		$setsqlarr[$key]=trim($base);
	}
	$tablename=table('resume_specialty');
	if ($resume_specialty)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable($tablename,$setsqlarr,$wheresql)?showmsg("保存失敗！",0,$link):'';
	}
	else
	{
		!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0,$link):'';
	}
	unset($setsqlarr);
	//學歷及專業培訓
	$itemarr=array('start','endtime','agency','course','education','description');
	$i=0;
	$tablename=table('resume_training');
	while ($i<5)
	{
		foreach ($itemarr as $item){
			if($i>0)
			{
				if(trim($_POST['t'][$item.$i]))$setsqlarr[$item]=trim($_POST['t'][$item.$i]);
			}
			else
			{
				if(trim($_POST['t'][$item]))$setsqlarr[$item]=trim($_POST['t'][$item]);
			}
			//數據校驗
		}

		if($setsqlarr)
		{
			$setsqlarr['uid']=$_SESSION['uid'];
			!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0,$link):'';
			unset($setsqlarr);
		}
		$i++;
	}
	unset($setsqlarr);
	//專業資格
	$itemarr=array('school','speciality','ways','getday');
	$i=0;
	$tablename=table('resume_education');
	while ($i<5)
	{
		foreach ($itemarr as $item){
			if($i>0)
			{
				if(trim($_POST['e'][$item.$i]))$setsqlarr[$item]=trim($_POST['e'][$item.$i]);
			}
			else if(trim($_POST['e'][$item]))$setsqlarr[$item]=trim($_POST['e'][$item]);
			//數據校驗
		}
		if($setsqlarr)
		{
			$setsqlarr['uid']=$_SESSION['uid'];
			!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0,$link):'';
			unset($setsqlarr);
		}
		$i++;
	}
	unset($setsqlarr);
	//工作經驗
	$itemarr=array('start','endtime', 'companyname','jobs','nature','salary','salary2');
	$i=0;
	$tablename=table('resume_work');
	while ($i<5)
	{
		foreach ($itemarr as $item){
			if($i>0)
			{
				if(trim($_POST['w'][$item.$i]))$setsqlarr[$item]=trim($_POST['w'][$item.$i]);
			}
			else if(trim($_POST['w'][$item]))$setsqlarr[$item]=trim($_POST['w'][$item]);
			//數據校驗
		}
		if($setsqlarr)
		{
			$setsqlarr['uid']=$_SESSION['uid'];
			!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0,$link):'';
			unset($setsqlarr);
		}
		$i++;
	}
	unset($setsqlarr);
	//技能特長

	//我喜歡的職位	
	//給求職者發送郵件，只能發送一次.
	//發送條件：行業，薪酬，崗位， 工作經驗，學歷，有效期
	$itemarr=array('category','subclass','district', 'wage','nature');
	$i=0;
	$tablename=table('resume_intention_foremail');
	$setsqlarr['uid']=$_SESSION['uid'];
	foreach($_POST['i'] as $key=>$base)
	{
		$setsqlarr[$key]=trim($base);
	}	
	if ($resume_intention_foremail)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable(table('resume_intention_foremail'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	}
	else
	{
		!inserttable(table('resume_intention_foremail'),$setsqlarr)?showmsg("保存失敗！",0):'';
	}	
		
	unset($setsqlarr);	
	

	$act='resume';
	showmsg("表格登記成功,稍後系統將為你發送合適的職位信息，請注意查收",2,$link);
}
//簡歷基本信息
if ($act=='resume_basic')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('experience',get_jobs_experience());
	$smarty->assign('education',get_jobs_education());
	$smarty->assign('area',get_jobs_area());
	$smarty->display('member_personal/personal_resume_basic.htm');
}
//保存簡歷基本信息
if ($act=='save_resume_basic')
{
	$_POST=htmldecode($_POST);
	$setsqlarr['uid']=$_SESSION['uid'];
	if (intval($setsqlarr['uid'])!=$setsqlarr['uid'] || !is_numeric($setsqlarr['uid']))showmsg('參數錯誤！',1);
	$setsqlarr['enname']=$_POST['enname'];
	$setsqlarr['fullname']=trim($_POST['fullname'])?trim($_POST['fullname']):showmsg('請填寫姓名！',1);
	$setsqlarr['sex']=$_POST['sex'];//trim($_POST['sex']).($_POST['sex']+0>0)?trim($_POST['sex']):showmsg('請選擇性別！',1);
	//$setsqlarr['age']=trim($_POST['age']).($_POST['age']+0>16)?trim($_POST['age']):showmsg('請正確填寫年齡！',1);
	$setsqlarr['birthday']=trim($_POST['birthday']);
	$setsqlarr['idcard']=trim($_POST['idcard']);
	$setsqlarr['country']=trim($_POST['country']);
	//	$setsqlarr['height']=trim($_POST['height']).($_POST['height']+100>100)?trim($_POST['height']):showmsg('請正確填寫身高！',1);
	$setsqlarr['marriage']=trim($_POST['marriage']).($_POST['marriage']+0>0)?trim($_POST['marriage']):showmsg('請選擇婚姻狀況！',1);
	//	$setsqlarr['experience']=trim($_POST['experience']).($_POST['experience']+0>0)?trim($_POST['experience']):showmsg('請選擇工作經驗！',1);
	//	$setsqlarr['householdaddress']=trim($_POST['householdaddress'])?trim($_POST['householdaddress']):showmsg('請填寫戶口所在地！',1);
	$setsqlarr['householdaddress']=trim($_POST['householdaddress']);
	//	$setsqlarr['education']=trim($_POST['education'])?trim($_POST['education']):showmsg('請選擇學歷！',1);
	$setsqlarr['education']=$_POST['education'];
	$setsqlarr['telephone']=trim($_POST['telephone'])?trim($_POST['telephone']):showmsg('請填寫聯系電話！',1);
	$setsqlarr['telehome']=trim($_POST['telehome']);
	$setsqlarr['teleoffice']=trim($_POST['teleoffice']);
	$setsqlarr['email']=trim($_POST['email'])?trim($_POST['email']):showmsg('請填寫電子郵箱！',1);
	$setsqlarr['email_notify']=$_POST['email_notify']=="1"?1:0;
	$setsqlarr['address']=trim($_POST['address'])?trim($_POST['address']):showmsg('請填寫通訊地址！',1);
	//$setsqlarr['area']=trim($_POST['area'])?trim($_POST['area']):showmsg('請填寫現所在地！',1);
	//$setsqlarr['website']=trim($_POST['website']);
	//$setsqlarr['qq']=trim($_POST['qq']);
	$setsqlarr['refreshtime']=$timestamp;
	if ($_CFG['audit_resume']==1)//假如發布簡歷需要審核
	{
		$setsqlarr['audit']=2;
	}
	else
	{
		$setsqlarr['audit']=1;
	}
	if ($resume_basic)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		$olddeadline=trim($_POST['deadline'])<$timestamp?$timestamp:trim($_POST['deadline']);
		if (intval($_POST['deadline_add'])>0) $setsqlarr['deadline']=strtotime("+".intval($_POST['deadline_add'])." day",$olddeadline);
		!updatetable(table('resume'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	}
	else
	{
		$setsqlarr['addtime']=$timestamp;
		$setsqlarr['deadline']=strtotime("+".intval($_POST['deadline'])." day");
		!inserttable(table('resume'),$setsqlarr)?showmsg("保存失敗！",0):'';
		$resume_click['uid']=$_SESSION['uid'];//
		$resume_click['click']=1;//
		!inserttable(table('resume_click'),$resume_click)?showmsg("保存失敗！",0):'';//插入簡歷點擊次數
	}
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態
	//	$act='resume_intention';
	showmsg("保存成功",2,$link);
}
//我喜歡的職位
if ($act=='resume_intention_foremail')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('category',get_jobs_category());//職位分類列表
	$smarty->assign('nature',get_jobs_nature());//職位性質列表
	$smarty->assign('wage',get_jobs_wage());//月薪分類列表
	$smarty->assign('area',get_jobs_area());//地區分類列表	
	$trade=get_jobs_trade();//截取字符串再顯示
	for($i=0;$i<count($trade);$i++)
	{
		$trade[$i]['categoryname']=cut_str($trade[$i]['categoryname'],9,0);
	}
	$smarty->assign('trade',$trade);//行業分類列表	
	$smarty->display('member_personal/personal_resume_intention_foremail.htm');
}
//保存-求職意向
if ($act=='save_resume_intention_foremail')
{
	//我喜歡的職位	
	//給求職者發送郵件，只能發送一次.
	//發送條件：行業，薪酬，崗位， 工作經驗，學歷，有效期
	$itemarr=array('category','subclass','district', 'wage','nature');
	$i=0;
	$tablename=table('resume_intention_foremail');
	$setsqlarr['uid']=$_SESSION['uid'];
	foreach($_POST['i'] as $key=>$base)
	{
		$setsqlarr[$key]=trim($base);
	}	
	if ($resume_intention_foremail)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable(table('resume_intention_foremail'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	}
	else
	{
		!inserttable(table('resume_intention_foremail'),$setsqlarr)?showmsg("保存失敗！",0):'';
	}			
	unset($setsqlarr);
	showmsg("保存成功",1,$link);
	//$smarty->display('member_personal/personal_resume_intention_foremail.htm');
}
//簡歷-求職意向
if ($act=='resume_intention')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('intention_nature',get_resume_intention_nature($_SESSION['uid']));//意向職位性質
	$smarty->assign('intention_jobs',get_resume_intention_jobs($_SESSION['uid']));//意向職位
	$smarty->assign('intention_area',get_resume_intention_area($_SESSION['uid']));//期望地區
	$smarty->assign('intention_trade',get_resume_intention_trade($_SESSION['uid']));//期望行業
	$smarty->assign('category',get_jobs_category());//職位分類列表
	$smarty->assign('nature',get_jobs_nature());//職位性質列表
	$smarty->assign('wage',get_jobs_wage());//月薪分類列表
	$smarty->assign('area',get_jobs_area());//地區分類列表
	$trade=get_jobs_trade();//截取字符串再顯示
	for($i=0;$i<count($trade);$i++)
	{
		$trade[$i]['categoryname']=cut_str($trade[$i]['categoryname'],9,0);
	}
	$smarty->assign('trade',$trade);//行業分類列表
	$smarty->display('member_personal/personal_resume_intention.htm');
}
//保存-求職意向
if ($act=='save_resume_intention')
{
	$_POST=htmldecode($_POST);
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['recentjobs']=trim($_POST['recentjobs']);
	$setsqlarr['wage']=trim($_POST['wage'])?trim($_POST['wage']):showmsg('請選擇期望月薪！',1);
	$nature=trim($_POST['nature'])?$_POST['nature']:showmsg('請選擇期望崗位性質！',1);
	$jobs=$_POST['jobs']?$_POST['jobs']:showmsg('請選擇期望從事的崗位！',1);
	$area=$_POST['area']?$_POST['area']:showmsg('請選擇期望工作地區！',1);
	$trade=$_POST['trade']?$_POST['trade']:showmsg('請選擇期望從事的行業！',1);
	$tablename=table('resume_intention');
	if ($resume_intention)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable($tablename,$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	}
	else
	{
		!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0):'';
	}
	if (!add_intention_nature($_SESSION['uid'],$nature)) showmsg('更新資料失敗！',0);
	if (!add_intention_jobs($_SESSION['uid'],$jobs)) showmsg('更新資料失敗！',0);
	if (!add_intention_area($_SESSION['uid'],$area)) showmsg('更新資料失敗！',0);
	if (!add_intention_trade($_SESSION['uid'],$trade)) showmsg('更新資料失敗！',0);
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態
	$act='resume_specialty';
}
//簡歷-技能特長
if ($act=='resume_specialty')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_specialty.htm');
}
//保存-技能特長
if ($act=='save_resume_specialty')
{
	$_POST=htmldecode($_POST);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = '?act=resume_specialty';
	$setsqlarr['uid']=$_SESSION['uid'];
	//	$setsqlarr['specialty']=trim($_POST['specialty'])?$_POST['specialty']:showmsg('請填寫您的技能特長！',1,$link);

	$postarr=array('gd','cm','en','fn','other','typeen','typecn','crime','once','relatives','thisname','thistime','thisoffice');
	$requeryarr=array('typeen'=>'請輸入英文打字速度','typecn'=>'請輸入中文數字','thisname'=>'請填寫簽名','thistime'=>'簽署日期是必須');
	foreach($postarr as $req){
		$setsqlarr[$req]=trim($_POST[$req]);
		if($requeryarr[$req]!='')trim($_POST[$req])?$_POST[$req]:showmsg($requeryarr[$req],1,$link);
	}
	if($_POST['agree']==0)showmsg('你必須同意該協議才可以繼續！',1,$link);

	$tablename=table('resume_specialty');
	if ($resume_specialty)
	{
		$wheresql=" uid='".$_SESSION['uid']."' ";
		!updatetable($tablename,$setsqlarr,$wheresql)?showmsg("保存失敗！",0,$link):'';
	}
	else
	{
		!inserttable($tablename,$setsqlarr)?showmsg("保存失敗！",0,$link):'';
	}
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態
	$act='resume_education';
}
//簡歷-教育經歷
if ($act=='resume_education')
{
	$smarty->assign('act',$act);
	//	$smarty->assign('education',get_jobs_education());
	$smarty->assign('ways',get_wayofeducation());
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_education.htm');
}
//保存-教育經歷
if ($act=='save_resume_education')
{
	$_POST=htmldecode($_POST);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = '?act=resume_education';
	if (count($resume_education)>=10) showmsg('教育經歷不能超過10條！',1,$link);
	$setsqlarr['uid']=$_SESSION['uid'];
	//$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	//$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['school']=trim($_POST['school'])?$_POST['school']:showmsg('請填專業團體！',1,$link);
	$setsqlarr['speciality']=trim($_POST['speciality'])?$_POST['speciality']:showmsg('請填寫所獲專業資格！',1,$link);
	$setsqlarr['ways']=trim($_POST['ways']);
	$setsqlarr['getday']=trim($_POST['getday'])?$_POST['getday']:showmsg('請填寫獲取日期！',1,$link);
	!add_education($setsqlarr['uid'],$setsqlarr)?showmsg("保存失敗！",0,$link):'';
	if ($_POST['save'])
	{
		echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_education'</script>");
		exit();
	}
}
//刪除教育經歷
if ($act=='del_education')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	!$db->query("Delete from ".table('resume_education')." WHERE id='".$id."'  AND uid='".$_SESSION['uid']."' ")?showmsg('刪除失敗！',0):showmsg('刪除成功！',2);
}
//修改教育經歷
if ($act=='edit_education')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	$smarty->assign('act',$act);
	$smarty->assign('ways',get_wayofeducation());
	$smarty->assign('hrer',$_SERVER['HTTP_REFERER']);;
	$smarty->assign('education_edit',get_resume_education_one($id));//修改的信息
	$smarty->assign('education',get_jobs_education());//學歷列表
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_education_edit.htm');
}
//保存修改的教育經歷
if ($act=='save_resume_education_edit')
{
	$_POST=htmldecode($_POST);
	$id=trim($_POST['id'])?$_POST['id']:showmsg('參數錯誤！',1);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = $_POST['hrer'];
	$setsqlarr['id']=$id;
	$setsqlarr['uid']=$_SESSION['uid'];
	//$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	//$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['school']=trim($_POST['school'])?$_POST['school']:showmsg('請填寫學校名稱！',1,$link);
	$setsqlarr['speciality']=trim($_POST['speciality'])?$_POST['speciality']:showmsg('請填寫專業名稱！',1,$link);
	$setsqlarr['ways']=trim($_POST['ways']);
	$setsqlarr['getday']=trim($_POST['getday'])?$_POST['getday']:showmsg('請填寫獲取日期！',1,$link);
	!edit_education($setsqlarr['uid'],$setsqlarr)?showmsg("修改失敗！",0,$link):showmsg("修改成功！",2,$link);
}
//簡歷-工作經歷
if ($act=='resume_work')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_work.htm');
}
//保存-添加的工作經歷
if ($act=='save_resume_work')
{
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = '?act=resume_work';
	if (count($resume_work)>=10) showmsg('工作經歷不能超過10條！',1,$link);
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['companyname']=trim($_POST['companyname'])?$_POST['companyname']:showmsg('請填寫企業名稱！',1,$link);
	$setsqlarr['jobs']=trim($_POST['jobs'])?$_POST['jobs']:showmsg('請填寫職位名稱！',1,$link);
	$setsqlarr['companyprofile']=trim($_POST['companyprofile']);
	$setsqlarr['achievements']=trim($_POST['achievements']);
	$setsqlarr['nature']=trim($_POST['nature']);
	$setsqlarr['salary']=trim($_POST['salary']);
	$setsqlarr['salary2']=trim($_POST['salary2']);
	!add_work($setsqlarr['uid'],$setsqlarr)?showmsg("保存失敗！",0,$link):'';
	echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_work'</script>");
	exit();
}
//刪除工作經歷
if ($act=='del_work')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	!$db->query("Delete from ".table('resume_work')." WHERE id='".$id."' AND uid='".$_SESSION['uid']."' ")?showmsg('刪除失敗！',0):showmsg('刪除成功！',2);
}
//修改工作經歷
if ($act=='edit_work')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	$smarty->assign('act',$act);
	$smarty->assign('hrer',$_SERVER['HTTP_REFERER']);
	$smarty->assign('work_edit',get_resume_work_one($id));//修改的信息
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_work_edit.htm');
}
//保存修改的工作經歷
if ($act=='save_resume_work_edit')
{
	$_POST=htmldecode($_POST);
	$id=trim($_POST['id'])?$_POST['id']:showmsg('參數錯誤！',1);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = $_POST['hrer'];
	$setsqlarr['id']=$id;
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['companyname']=trim($_POST['companyname'])?$_POST['companyname']:showmsg('請填寫企業名稱！',1,$link);
	$setsqlarr['jobs']=trim($_POST['jobs'])?$_POST['jobs']:showmsg('請填寫職位名稱！',1,$link);
	$setsqlarr['companyprofile']=trim($_POST['companyprofile']);
	$setsqlarr['achievements']=trim($_POST['achievements']);
	$setsqlarr['nature']=trim($_POST['nature']);
	$setsqlarr['salary']=trim($_POST['salary']);
	$setsqlarr['salary2']=trim($_POST['salary2']);
	!edit_work($setsqlarr['uid'],$setsqlarr)?showmsg("修改失敗！",0,$link):showmsg("修改成功！",2,$link);
}
//簡歷-培訓經歷
if ($act=='resume_training')
{
	$smarty->assign('act',$act);
	$smarty->assign('education',get_jobs_education());
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_training.htm');
}
//保存-添加的培訓經歷
if ($act=='save_resume_training')
{
	$_POST=htmldecode($_POST);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = '?act=resume_training';
	if (count($resume_training)>=10) showmsg('培訓經歷不能超過10條！',1,$link);
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['agency']=trim($_POST['agency'])?$_POST['agency']:showmsg('請填寫機構名稱！',1,$link);
	$setsqlarr['course']=trim($_POST['course'])?$_POST['course']:showmsg('請填寫課程名稱！',1,$link);
	$setsqlarr['education']=trim($_POST['education']);
	$setsqlarr['description']=trim($_POST['description']);
	!add_training($setsqlarr['uid'],$setsqlarr)?showmsg("保存失敗！",0,$link):'';
	echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_training'</script>");
	exit();
}
//刪除培訓經歷
if ($act=='del_training')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	!$db->query("Delete from ".table('resume_training')." WHERE id='".$id."' AND uid='".$_SESSION['uid']."' ")?showmsg('刪除失敗！',0):showmsg('刪除成功！',2);
}
//修改工作經歷
if ($act=='edit_training')
{
	$id=trim($_GET['id'])?$_GET['id']:showmsg('參數錯誤！',1);
	if (intval($id)!=$id)showmsg('參數錯誤！',1);
	$smarty->assign('act',$act);
	$smarty->assign('education',get_jobs_education());
	$smarty->assign('hrer',$_SERVER['HTTP_REFERER']);;
	$smarty->assign('training_edit',get_resume_training_one($id));//修改的信息
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_training_edit.htm');
}
//保存修改的培訓經歷
if ($act=='save_resume_training_edit')
{
	$_POST=htmldecode($_POST);
	$id=trim($_POST['id'])?$_POST['id']:showmsg('參數錯誤！',1);
	$link[0]['text'] = "返回上一頁";
	$link[0]['href'] = $_POST['hrer'];
	$setsqlarr['id']=$id;
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['start']=trim($_POST['start'])?$_POST['start']:showmsg('請填寫開始時間！',1,$link);
	$setsqlarr['endtime']=trim($_POST['endtime'])?$_POST['endtime']:showmsg('請填寫結束時間！',1,$link);
	$setsqlarr['agency']=trim($_POST['agency'])?$_POST['agency']:showmsg('請填寫機構名稱！',1,$link);
	$setsqlarr['course']=trim($_POST['course'])?$_POST['course']:showmsg('請填寫課程名稱！',1,$link);
	$setsqlarr['description']=trim($_POST['description']);
	$setsqlarr['education']=trim($_POST['education']);
	!edit_training($setsqlarr['uid'],$setsqlarr)?showmsg("修改失敗！",0,$link):showmsg("修改成功！",2,$link);
}
//簡歷-形象照片
if ($act=='resume_photo')
{
	if ($resume_photo && file_exists($photo_dir.$resume_photo['photo']))//檢查圖片是否存在,若果存在就跳轉到裁切頁面，否則則添加照片
	{
		$act='resume_photo_cutting';
	}
	else
	{
		$act='resume_photo_add';
	}
}
//簡歷-形象照片
if ($act=='resume_photo_add')
{
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_photo.htm');
}
//簡歷-保存上傳的照片
if ($act=='save_resume_photo')
{
	!$_FILES['photo']['name']?showmsg('請上傳圖片！',1):"";
	require_once(QISHI_ROOT_PATH.'include/upload_img.php');
	$setsqlarr['uid']=$_SESSION['uid'];
	if ($_CFG['audit_resume_photo']==1)//假如發布照片需要審核
	{
		$setsqlarr['audit']=2;
	}
	else
	{
		$setsqlarr['audit']=1;
	}
	$setsqlarr['photo']=_asUpFiles($photo_dir, "photo",$_CFG['resume_photo_max'],'gif/jpg/bmp/png',true);
	@unlink($photo_dir.$resume_photo['photo']);//先刪除原始照片
	@unlink($photo_thumb_dir.$resume_photo['photo']);//刪除原始照片縮略
	if (!edit_photo($setsqlarr['uid'],$setsqlarr)) showmsg("保存失敗！",0);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態
	echo ("<script language=\"javascript\" type=\"text/javascript\">window.location.href='?act=resume_photo_cutting'</script>");
	exit();
}
//簡歷-裁切照片
if ($act=='resume_photo_cutting')
{
	if (file_exists($photo_thumb_dir.$resume_photo['photo']))//檢測縮略圖是否存在
	{
		$smarty->assign('photo_thumb',1);
	}
	$smarty->assign('act',$act);
	$smarty->assign('title','編輯簡歷 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume_photo_cutting.htm');
}
//保存-裁切照片
if ($act=='save_resume_photo_cutting')
{
	require_once(QISHI_ROOT_PATH.'include/imageresize.class.php');
	$imgresize = new ImageResize(); //創建圖片縮放和裁剪類
	$imgresize->load($photo_dir.$resume_photo['photo']); //載入原始圖片
	$posary=explode(',', $_POST['cut_pos']);
	foreach($posary as $k=>$v) $posary[$k]=intval($v); //獲得縮放比例和裁剪位置
	if($posary[2]>0 && $posary[3]>0) $imgresize->resize($posary[2], $posary[3]); //圖片縮放
	$imgresize->cut(120,150, intval($posary[0]), intval($posary[1]));
	$imgresize->save($photo_thumb_dir.$resume_photo['photo']);
	check_resume($_SESSION['uid']);//更新簡歷完成狀態
	header('Location: ?act=resume_photo_cutting');
}
//保存-縮略圖片
if ($act=='save_resume_photo_thumb')
{
	if (!edit_photo_display($_SESSION['uid'],$_POST['display'])) showmsg("保存失敗！",0);
	header('Location: ?act=resume');
}
//簡歷公開設置
if ($act=='resume_display_set')
{
	$smarty->assign('title','簡歷公開設置 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_display_set.htm');
}
//保存簡歷公開設置
if ($act=='save_display_set')
{
	$setsqlarr['display']=trim($_POST['display'])?trim($_POST['display']):showmsg('請選擇項目！',1);
	$setsqlarr['uid']=$_SESSION['uid'];
	$wheresql=" uid='".$_SESSION['uid']."' ";
	!updatetable(table('resume'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷狀態
	showmsg('設置成功！',2);
}
//申請成為高級人才
if ($act=='talent')
{
	if ($resume_basic['complete']!="1")showmsg("申請職位失敗，請先完善您的個人簡歷",1);
	$smarty->assign('title','申請高級人才 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_talent.htm');
}
//保存申請高級人才
if ($act=='talent_save')
{
	$setsqlarr['talent']=3;
	$setsqlarr['uid']=$_SESSION['uid'];
	$wheresql=" uid='".$_SESSION['uid']."' ";
	!updatetable(table('resume'),$setsqlarr,$wheresql)?showmsg("保存失敗！",0):'';
	unset($setsqlarr);
	check_resume($_SESSION['uid']);//更新簡歷狀態
	showmsg('申請成功，請等待管理員審核！',2);
}
//******************************************************************求職管理
//收到的企業面試邀請列表
if ($act=='invitation_interview')
{
	require_once(QISHI_ROOT_PATH.'include/page.class.php');
	$wheresql=" WHERE resume_uid='".$_SESSION['uid']."' ";
	$perpage=10;
	$total_sql="SELECT COUNT(*) AS num FROM ".table('company_invitation_interview').$wheresql;
	$total_val=get_total($total_sql);
	$page = new page(array('total'=>$total_val, 'perpage'=>$perpage));
	$currenpage=$page->nowindex;
	$offset=($currenpage-1)*$perpage;
	$smarty->assign('title','面試邀請 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('invitation_interview',get_invitation_interview($offset, $perpage,$wheresql));
	if ($total_val>$perpage)
	{
		$smarty->assign('page',$page->show(3));//分頁符
	}
	$smarty->display('member_personal/personal_invitation_interview.htm');
}
//詳細面試邀請
if ($act=='invitation_interview_show')
{
	$smarty->assign('invitation_interview',get_invitation_interview_one(intval($_GET['id'])));//
	$smarty->assign('title','查看面試邀請 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_invitation_interview_show.htm');
}
//刪除-面試邀請
if ($act=='del_invitation_interview')
{
	$yid =trim($_REQUEST['y_id'])?$_REQUEST['y_id']:showmsg("你沒有選擇項目！",1);
	$delete =trim($_POST['delete']);
	$delete?(!del_invitation_interview($yid,$_SESSION['uid'])?showmsg("刪除失敗！",0):showmsg("刪除成功！",2)):'';
}
//添加到職位收藏夾
if ($act=='add_jobs_library')
{
	!add_jobs_library($_GET,$_SESSION['uid'])?showmsg("此職位已經存在職位收藏夾中，請不要重復添加！",1):showmsg("成功添加到你的職位收藏夾！",2);
}
//職位收藏夾列表
if ($act=='jobs_library_list')
{
	require_once(QISHI_ROOT_PATH.'include/page.class.php');
	$wheresql=" WHERE personal_uid='".$_SESSION['uid']."' ";
	$perpage=10;
	$total_sql="SELECT COUNT(*) AS num FROM ".table('personal_jobs_library').$wheresql;
	$total_val=get_total($total_sql);
	$page = new page(array('total'=>$total_val, 'perpage'=>$perpage));
	$currenpage=$page->nowindex;
	$offset=($currenpage-1)*$perpage;
	$smarty->assign('title','職位收藏夾 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('jobs_library',get_jobs_library($offset, $perpage,$wheresql));
	if ($total_val>$perpage)
	{
		$smarty->assign('page',$page->show(3));//分頁符
	}
	$smarty->display('member_personal/personal_jobs_library_list.htm');
}
//新申請一個職位
if ($act=='jobs_apply_add')
{
	$jobs_id=$_GET['jobs_id'];
	$smarty->assign('title','職位申請- '.$_CFG['site_name']);
	if ($jobs_id && intval($jobs_id)==$jobs_id && $_SESSION['uid'])
	{
		if ($resume_basic['complete']!="1")showmsg("申請職位失敗，請先填寫求職者表格",1);
		if (check_jobs_apply($jobs_id,$_SESSION['uid'])) showmsg("您已經申請此職位啦，不能重復申請!",1);
		$smarty->assign('url',$_SERVER['HTTP_REFERER']);
		$smarty->assign('jobs_id',$jobs_id);
		$smarty->assign('jobs_url',url_rewrite('jobs-show',array('id0'=>$jobs_id)));
		$smarty->assign('jobs_name',$_GET['jobs_name']);
		$smarty->assign('company_id',$_GET['company_id']);
		$smarty->assign('company_uid',$_GET['company_uid']);
		$smarty->assign('company_name',$_GET['company_name']);
		$smarty->assign('company_category',$_GET['company_category']);
		$smarty->assign('company_subclass',$_GET['company_subclass']);
		$smarty->assign('company_url',url_rewrite('company',array('id0'=>$_GET['company_id'])));
		$smarty->display('member_personal/personal_jobs_apply_add.htm');
	}
}
//新申請一個職位
if ($act=='jobs_apply_add_save')
{
	$link[0]['text'] = "返回上一頁！";
	$link[0]['href'] = $_POST['url'];
	$link[1]['text'] = "查看已申請的職位";
	$link[1]['href'] = '?act=jobs_apply_list';
	$addarr['personal_uid']=$_SESSION['uid'];
	$addarr['personal_fullname']=$_POST['personal_fullname'];
	$addarr['personal_sex']=$_POST['personal_sex'];
//	$addarr['personal_birthday']=$_POST['personal_birthday'];
	$addarr['jobs_id']=intval($_POST['jobs_id']);
	$addarr['jobs_name']=$_POST['jobs_name'];
	$addarr['company_id']=intval($_POST['company_id']);
	$addarr['company_uid']=intval($_POST['company_uid']);
	$addarr['company_name']=$_POST['company_name'];
//	$addarr['jobs_category']=$_POST['jobs_category'];
//	$addarr['jobs_subclass']=$_POST['jobs_subclass'];
	$addarr['once']= $_POST['once'];
	$addarr['relatives']= $_POST['relatives'];
	$addarr['notes']= $_POST['notes'];
	$addarr['addtime']=$timestamp;
	$addarr['personal_look']=1;
	if (inserttable(table('personal_jobs_apply'),$addarr))
	{
		$mailconfig=get_cache('mailconfig');
		if ($mailconfig['set_applyjobs']=="1")
		{
			require_once(QISHI_ROOT_PATH.'include/fun_jobs.php');
			$jobs=get_jobs_one($addarr['jobs_id']);
			if (1)
//			if ($jobs['contact']['notify']=="1")
			{
				require_once(QISHI_ROOT_PATH.'include/fun_user.php');
//				asyn_sendmail($_CFG['site_domain'].$_CFG['site_dir']."asyn_mail.php?uid=".$_SESSION['uid']."&key=".asyn_userkey($_SESSION['uid'])."&act=jobs_apply&jobs_id=".$addarr['jobs_id']."&jobs_name=".$addarr['jobs_name']."&personal_fullname=".$addarr['personal_fullname']."&email=".$jobs['contact']['email']);
				//讀取郵件配置信息
				$mail_templates=get_cache('mail_templates');
				$templates=$mail_templates['set_applyjobs'];
				$templates=str_replace('{$sitedomain}',$_CFG['site_domain'].$_CFG['site_dir']. "jobs-show.php?id=". $jobs['id'],$templates);
				$templates=str_replace('{$personalfullname}',$addarr['personal_fullname'],$templates);
				$templates=str_replace('{$jobsname}','中文名稱:'.$jobs['jobs_name_cn'].' 英文名稱:'. $jobs['jobs_name_cn'],$templates);
				smtp_mail($_CFG['admin_mail'],$addarr['personal_fullname']." 申請了您發布的空缺:".$addarr['jobs_name'],$templates);
			}
		}
		showmsg("申請已經投遞，請等待對方確認並聯繫您。",2,$link,false);
	}
	else
	{
		showmsg("申請失敗！可能該職位已經被刪除或過期。",1);
	}
}
//申請的職位列表
if ($act=='jobs_apply_list')
{
	require_once(QISHI_ROOT_PATH.'include/page.class.php');
	$wheresql=" WHERE personal_uid='".$_SESSION['uid']."' ";
	$perpage=10;
	$total_sql="SELECT COUNT(*) AS num FROM ".table('personal_jobs_apply').$wheresql;
	$total_val=get_total($total_sql);
	$page = new page(array('total'=>$total_val, 'perpage'=>$perpage));
	$currenpage=$page->nowindex;
	$offset=($currenpage-1)*$perpage;
	$smarty->assign('title','已申請的職位 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('jobs_apply',get_jobs_apply($offset, $perpage,$wheresql));
	if ($total_val>$perpage)
	{
		$smarty->assign('page',$page->show(3));//分頁符
	}
	$smarty->display('member_personal/personal_jobs_apply_list.htm');
}
//刪除-申請的職位列表
if ($act=='del_jobs_apply')
{
	$yid =trim($_REQUEST['y_id'])?$_REQUEST['y_id']:showmsg("你沒有選擇項目！",1);
	$delete =trim($_POST['delete']);
	$delete?(!del_jobs_apply($yid,$_SESSION['uid'])?showmsg("刪除失敗！",0):showmsg("刪除成功！",2)):'';
}
//-----------------------------------------賬戶管理
//修改密碼
if ($act=='password_edit')
{
	$smarty->assign('title','修改密碼 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_password.htm');
}
//保存修改密碼
if ($act=='save_password')
{
	require_once(QISHI_ROOT_PATH.'include/fun_user.php');
	$arr['username']=$_SESSION['username'];
	$arr['oldpassword']=trim($_POST['oldpassword'])?trim($_POST['oldpassword']):showmsg('請輸入舊密碼！',1);
	$arr['password']=trim($_POST['password'])?trim($_POST['password']):showmsg('請輸入新密碼！',1);
	if ($arr['password']!=trim($_POST['password1'])) showmsg('兩次輸入密碼不相同，請重新輸入！',1);
	$info=edit_password($arr);
	if ($info==-1) showmsg('舊密碼輸入錯誤，請重新輸入！',1);
	if ($info==$_SESSION['username']){
		//發送郵件
		$mailconfig=get_cache('mailconfig');
		if ($mailconfig['set_editpwd']=="1")
		{
			require_once(QISHI_ROOT_PATH.'include/fun_user.php');
			asyn_sendmail($_CFG['site_domain'].$_CFG['site_dir']."asyn_mail.php?uid=".$_SESSION['uid']."&key=".asyn_userkey($_SESSION['uid'])."&act=set_editpwd&password=".$arr['password']);
		}
		//郵件發送完畢
		showmsg('密碼修改成功！',2);
	}
}
//----------------------
//用戶反饋
if ($act=='feedback')
{
	$smarty->assign('title','用戶反饋 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('feedback',get_feedback($_SESSION['uid']));
	$smarty->display('member_personal/personal_feedback.htm');
}
//保存用戶反饋
if ($act=='feedback_save')
{
	$get_feedback=get_feedback($_SESSION['uid']);
	if (count($get_feedback)>=5)
	{
		showmsg('反饋信息不能超過5條！',1);
		exit();
	}
	$setsqlarr['infotype']=trim($_POST['infotype']);
	$setsqlarr['feedback']=trim($_POST['feedback']);
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['usertype']=$_SESSION['utype'];
	$setsqlarr['username']=$_SESSION['username'];
	$setsqlarr['addtime']=$timestamp;
	!inserttable(table('feedback'),$setsqlarr)?showmsg("添加失敗！",0):showmsg("添加成功，請等待管理員回復！",2);
}
//刪除用戶反饋
if ($act=='del_feedback')
{
	$id=trim($_GET['id']);
	del_feedback($id,$_SESSION['uid'])?showmsg('刪除成功！',2):showmsg('刪除失敗！',1);
}
//更新簡歷
if ($act=='refresh')
{
	if ($resume_basic['complete']!="1")showmsg(" 請先到完善您的個人簡歷",1);
	check_resume($_SESSION['uid']);//更新簡歷狀態
	showmsg('更新成功！',2);
}
//舉報信息
if ($act=='report')
{
	$smarty->assign('title','舉報信息 - 個人會員中心 - '.$_CFG['site_name']);
	$smarty->assign('url',$_SERVER['HTTP_REFERER']);
	$smarty->display('member_personal/personal_report.htm');
}
//保存舉報信息
if ($act=='report_save')
{
	$link[0]['text'] = "返回上一頁！";
	$link[0]['href'] = $_POST['url'];
	$setsqlarr['content']=trim($_POST['content'])?trim($_POST['content']):showmsg('請輸入相關描述！',1);
	$setsqlarr['jobs_id']=trim($_POST['jobs_id'])?trim($_POST['jobs_id']):showmsg('沒有職位ID',1);
	$setsqlarr['jobs_name']=trim($_POST['jobs_name'])?trim($_POST['jobs_name']):showmsg('沒有職位名稱',1);
	$setsqlarr['uid']=$_SESSION['uid'];
	$setsqlarr['addtime']=$timestamp;
	!inserttable(table('report'),$setsqlarr)?showmsg("舉報失敗！",0,$link):showmsg("舉報成功，管理員會認真處理！",2,$link);
}
?>
